;;;; -*- Mode: LISP; Syntax: COMMON-LISP -*-
(defun boot () 
  (write-message "booting the substrate...")
;  (index "index.html")
  (index "http://www.google.com"))
;  (index "file:///home/evenson/work/ws-sql/"))

(defun index (iri)
    (new 
     (-Ajax.-Request iri
		     (create :method "get"
			     :on-loading (write-message
					  "on-loading")
			     :on-complete (write-message "completed")))))


(defun replace-remote (xml)
  (write-message "success")
  (write-message xml)
  (write-message xml.getAllResponseHeaders)
  (write-message xml.responseText)
  (write-message xml.responseXML))

(defun write-message(message)
   (let ((boot (document.create-element "pre")))
     (document.body.append-child boot)
     (-element.update boot message)))


(defun foo () 
  (alert "foo"))
		       

;; new Ajax.Request('/some_url',
;;   {
;;     method:'get',
;;     onSuccess: function(transport){
;;       var response = transport.responseText || "no response text";
;;       alert("Success! \n\n" + response);
;;     },
;;     onFailure: function(){ alert('Something went wrong...') }
;;   });
